package com.dji.ux.sample.MediaManager;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.dji.ux.sample.Adapter.PanoTaskAdapter;
import com.dji.ux.sample.Adapter.PanoTaskBean;
import com.dji.ux.sample.R;

import java.util.ArrayList;
import java.util.List;

public class PanoTaskPanel extends RelativeLayout {

    private RecyclerView pano_recyclerView;
    private PanoTaskAdapter panoTaskAdapter;
    private Context mcontext;
    private List<PanoTaskBean> mDatas;

    public PanoTaskPanel(Context context, AttributeSet attrs) {
        super(context, attrs);
        mcontext = context;
        mDatas = new ArrayList<>();
        LayoutInflater.from(context).inflate(R.layout.pano_task_panel, this);
        pano_recyclerView = findViewById(R.id.pano_task_recycler_view);
        pano_recyclerView.setLayoutManager(new LinearLayoutManager(mcontext, LinearLayoutManager.VERTICAL, false));

        panoTaskAdapter = new PanoTaskAdapter(mcontext, mDatas);
        pano_recyclerView.setAdapter(panoTaskAdapter);

    }

    public void refreshData(List<PanoTaskBean> data) {
        panoTaskAdapter.refreshData(data);
        Log.d("PANO", "refreshData" + data.toString());
    }

    public void updatePanoProgress(int position, int progress, int shoot_num) {
        panoTaskAdapter.updatePanoProress(position, progress, shoot_num);
    }

    public void updateSaveProgress(int position, int progress) {
        panoTaskAdapter.updateSaveProress(position, progress);
    }

    public void updateSavePath(int position, String path) {
        panoTaskAdapter.updateSavePath(position, path);
    }

    public void updateUploadProgress(int position, int progress) {
        panoTaskAdapter.updateUploadProgress(position, progress);
    }

    public void updatePanoStatus(int positionm, String status) {
        panoTaskAdapter.updatePanoStatus(positionm, status);
    }
}
